<?php
require_once '../utils/Database.php';
require_once '../utils/Response.php';

$db = new Database();
$method = $_SERVER['REQUEST_METHOD'];

switch ($method) {
    case 'GET':
        if (isset($_GET['action']) && $_GET['action'] == 'contact') {
            // 获取联系我们信息
            $configs = $db->fetchAll("SELECT config_key, config_value FROM system_config");
            
            $contactInfo = [];
            foreach ($configs as $config) {
                $contactInfo[$config['config_key']] = $config['config_value'];
            }
            
            Response::success($contactInfo, '获取成功');
        } else {
            Response::error('无效的操作');
        }
        break;
        
    default:
        Response::error('不支持的请求方法');
}
?>